//
//  HMGuideViewController.m
//  localLife
//
//  Created by Limonwei on 15/11/23.
//  Copyright © 2015年 heima. All rights reserved.
//

#import "HMGuideViewController.h"
#import "AppDelegate.h"
#import "HMFunction.h"

@interface HMGuideViewController ()

@end

@implementation HMGuideViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:kUIScreenBounds];
    
    scrollView.contentSize = CGSizeMake(3*kUIScreenWidth, 0);
    
    scrollView.showsHorizontalScrollIndicator = NO;
    
    scrollView.bounces = NO;
    
    scrollView.pagingEnabled = YES;
    
    [self.view addSubview:scrollView];
    
    for (int i = 0; i<3; i++) {
        //
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(i*kUIScreenWidth, 0, kUIScreenWidth, kUIScreenHeight)];
        
        NSString *imageName = [NSString stringWithFormat:@"guide_%d",i];
        
        imageView.image = [UIImage imageNamed:imageName];
        
        [scrollView addSubview:imageView];
        
        if (i == 2) {
            UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(enter)];
            
            imageView.userInteractionEnabled = YES;
            
            [imageView addGestureRecognizer:tap];
        }
    }
}


-(void)enter{
    
    [HMFunction saveValue:YES forKey:kFirstLanuch];
    
    [[NSNotificationCenter defaultCenter]postNotificationName:kNotificationGuideEnter object:nil];
    
}
@end


























